<?php
namespace app\admin\controller;

use app\common\controller\Admin;
use think\facade\View;

class MemberActionLog extends Admin
{
    protected $modelClass = '\app\common\model\MemberActionLog';
    protected $searchTime = 'a.create_time';
    
    protected function setLang()
    {
        $this->searchArr = [
            'username' => lang('username'),
            'name' => lang('name'),
            'infos' => lang('infos'),
            'ip' => lang('ip'),
        ];
    }
    
    public function index()
    {
        $this->_indexSearch();
        
        $where = [];
        $getSearch = $this->_getSearch();
        if (!empty($getSearch)) $where[] = $getSearch;
        
        if (input('get._sort')){
            $order = explode(',', input('get._sort'));
            $order = $order[0].' '.$order[1];
        }else{
            $order = 'id desc';
        }
        $dataList = $this->cModel
        ->alias('a')
        ->join('member b', 'a.uid = b.id', 'left')
        ->field('a.*,b.username,b.name')
        ->where($where)->order($order)->paginate('', false, page_param());
        
        View::assign('dataList', $dataList);
        return View::fetch();
    }
}